package com.study.ye.controller;

import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.*;


 class Test1controller {

     public static void main(String[] args) throws IOException {
         //A();
         B();
     }

     public static void A() {
         File file = new File("D:\\uploads\\aa.txt");
         String aa = "你好啊";
         try {
             FileOutputStream outputStream = new FileOutputStream(file);
             byte[] aaBytes = aa.getBytes();
             outputStream.write(aaBytes);
             outputStream.close();
         } catch (IOException e) {
             throw new RuntimeException(e);
         }
     }

     public static void B() throws IOException {
         File file = new File("D:\\uploads\\aa.txt");
         try (BufferedReader br = new BufferedReader(new FileReader(file))) {
             String line;
             // 按行读取，直到 null（文件结束）
             while ((line = br.readLine()) != null) {
                 System.out.println(line); // 输出每行内容
             }
         }
     }
 }


